package com.fenqing.leetcode.code.t2500_2600;

import com.fenqing.annotations.Execute;
import com.fenqing.core.Topic;

import java.util.Arrays;

public class Topic2500 extends Topic {

    @Execute
    public int deleteGreatestValue(int[][] grid) {
        if (grid.length == 0) {
            return 0;
        }
        if (grid.length == 1) {
            return Arrays.stream(grid[0]).sum();
        }
        int n = grid[0].length;
        int sum = 0;
        for (int i = 0; i < grid.length; i++) {
            int[] nums = grid[i];
            //排序
            Arrays.sort(nums);
        }
        for (int i = 0; i < n; i++) {
            int max = 0;
            for (int j = 0; j < grid.length; j++) {
                if (max < grid[j][i]) {
                    max = grid[j][i];
                }
            }
            sum += max;
        }
        return sum;
    }

    public static void main(String[] args) {
        Topic2500 topic2500 = new Topic2500();
        int run = topic2500.run("[[23,99],[83,5],[21,76],[34,99],[63,23]]");
        System.out.println(run);
    }

}
